package checkRecord;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Solution {
    public boolean checkRecord(String s) {
        // 哈希表计数
        int Absent = 0;
        int Late = 0;
        for (int i = 0; i < s.length(); i++) {
            if(s.charAt(i) == 'A') {
                if(Absent == 1) return false;
                Absent = 1;
            } else if (s.charAt(i) == 'L') {
                if (i>0&&s.charAt(i-1) != 'L') {
                    Late = 1;
                } else {
                    if (Late == 2) return false;
                    Late++;
                }
            }
        }
        return true;
    }
}
